<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="java.io.*,java.util.*,java.net.*,java.text.*"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%
    try{
        // 页面标题
        request.setAttribute("titleName",URLDecoder.decode("注册", "UTF-8"));
    }catch (Exception e){
        e.printStackTrace();
    }finally {
    }
%>
<html>
<head>
    <meta charset="utf-8" />
    <title>注册</title>
    <meta name="Keywords" content="中信信用卡平台" />
    <meta name="Description" content="注册"/>
    <meta name="robots" content="all"/>
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta http-equiv="cleartype" content="on"/>
    <link rel="icon" type="image/png" href="images/favicon.ico">
    <%@ include file="/site/css.jsp" %>
</head>
<body>
<div id="page">
    <%@ include file="/site/header_nav.jsp" %>
    <div id="container">
        <form id="add_form" action="${ctx}/site/site.action.jsp?action=register" method="POST">
            <div style="line-height: 36px;margin-top:8px;">
                <label style="width:80px;display:inline-block;">用户名<span style="color:red;">*</span></label>
                <input class="text" autocomplete="0" id="USERNAME" name="USERNAME" placeholder="请输入用户名">
            </div>
            <div style="line-height: 36px;margin-top:8px;">
                <label style="width:80px;display:inline-block;">密码<span style="color:red;">*</span></label>
                <input class="text" autocomplete="0" id="PASSWORD" name="PASSWORD" placeholder="请输入密码" type="password">
            </div>
            <div style="line-height: 36px;margin-top:8px;">
                <label style="width:80px;display:inline-block;">确认密码<span style="color:red;">*</span></label>
                <input class="text" autocomplete="0" id="RE_PASSWORD" placeholder="确认密码" type="password">
            </div>
            <div style="line-height: 36px;margin-top:8px;">
            	<input type="checkbox" id="xieyi" />&nbsp;&nbsp;<a href="xieyi.jsp">同意注册协议</a>
            </div>
        </form>
        <div class="box-btn clearfix">
            <a href="#" onclick="register();return false;" class="button big green" >注册</a>
        </div>
    </div>
    <%@ include file="/site/footer.jsp" %>
</div>
<%@ include file="/site/js.jsp" %>
<script src="${ctx}/site/js/jquery.form.js"></script>
<script>
    $('#add_form').ajaxForm({
        success:function(result,statusText,xhr,ele){
            if(result.isSuccess){
                appUtil.alert("注册成功！");
                setTimeout(function(){
                    window.location.href = "${ctx}/site/index.jsp";
                },1500);
            }else{
                appUtil.alert("注册失败："+result.error);
            }
        }
    });
    $(document).ready(function(){
        
    });
    /*** 保存注册信息 ***/
    function register(){
    	if($("#USERNAME").val().length < 1){
            appUtil.alert("请输入帐号！");
            $("#USERNAME").focus();
            return;
        }
        var pwd = $("#PASSWORD").val();
        var rePwd = $("#RE_PASSWORD").val();
        if(pwd.length < 1){
            appUtil.alert("请输入密码！");
            $("#PASSWORD").focus();
            return;
        }
        if(rePwd.length < 1){
            appUtil.alert("请输入确认密码！");
            $("#RE_PASSWORD").focus();
            return;
        }
        if(pwd != rePwd){
            appUtil.alert("密码与确认密码必须一致！");
            $("#RE_PASSWORD").focus();
            return;
        }
        if(!$('#xieyi').is(":checked")){
            appUtil.alert("必须同意注册协议！");
            return;
        }
        $('#add_form').submit();
    }
</script>
</body>
</html>